import matplotlib.pyplot as plt

from chart.random_walk import RandomWalk

# 静态图
# 创建一个 RandomWalk 实例，并将其包含的点都绘制出来
# rw = RandomWalk()
# rw.fill_walk()

# plt.scatter(rw.x_values, rw.y_values, s=15)
# plt.savefig('randomWalk_plot.png')
# plt.show()

# 动态图
while True:
    rw = RandomWalk()
    rw.fill_walk()

    num_points = list(range(rw.num_points))
    plt.scatter(rw.x_values, rw.y_values, c=num_points, cmap=plt.cm.Reds, edgecolor='none', s=15)
    plt.show()
    keep_running = input("Make another walk? (y/n): ")
    if keep_running == 'n':
        break
